package jie.config;

import jie.intercptor.MyInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        registry.addViewController("/").setViewName("login");
        registry.addViewController("/info/tobalance").setViewName("balance");
        registry.addViewController("/info/totransfer").setViewName("transfer");
        registry.addViewController("/info/towelcome").setViewName("welcome");
        registry.addViewController("/info/toupdatePwd").setViewName("updatePwd");
        registry.addViewController("/info/torecord").setViewName("record");

    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor()).addPathPatterns("/info/**")
                .excludePathPatterns("/info/login","/info/logout");
    }


}
